package com.edu.test.commandPattern;

import java.util.ArrayList;

/**
 * @作者 five-five
 * @创建时间 2020/12/26
 */
public class Invoker {
    private ArrayList<Command> commands = new ArrayList<>();

    public boolean addCommand(Command command) {
        return commands.add(command);
    }

    public boolean removeCommand(Command command) {
        return commands.remove(command);
    }

    public void executeCommands() {
        for (Command command : commands) {
            command.exceute();
        }
    }
}
